﻿using System;

namespace Dynamic.Data.Model.Query
{
    public static class ConditionOperatorUtility
    {
        public static ConditionOperator ConvertToConditionOperator(string conditionOperator)
        {
            ConditionOperator reval = ConditionOperator.Equal;

            switch (conditionOperator.ToLower())
            {
                case "beginswith":
                    reval = ConditionOperator.BeginsWith;
                    break;
                case "between":
                    reval = ConditionOperator.Between;
                    break;
                case "childof":
                    reval = ConditionOperator.ChildOf;
                    break;
                case "contains":
                    reval = ConditionOperator.Contains;
                    break;
                case "doesnotbeginwith":
                    reval = ConditionOperator.DoesNotBeginWith;
                    break;
                case "doesnotcontain":
                    reval = ConditionOperator.DoesNotContain;
                    break;
                case "doesnotendwith":
                    reval = ConditionOperator.DoesNotEndWith;
                    break;
                case "endswith":
                    reval = ConditionOperator.EndsWith;
                    break;
                case "equal":
                    reval = ConditionOperator.Equal;
                    break;
                case "equalbusinessid":
                    reval = ConditionOperator.EqualBusinessId;
                    break;
                case "equaluserid":
                    reval = ConditionOperator.EqualUserId;
                    break;
                case "equaluserlanguage":
                    reval = ConditionOperator.EqualUserLanguage;
                    break;
                case "greaterequal":
                    reval = ConditionOperator.GreaterEqual;
                    break;
                case "greaterthan":
                    reval = ConditionOperator.GreaterThan;
                    break;
                case "in":
                    reval = ConditionOperator.In;
                    break;
                case "last7days":
                    reval = ConditionOperator.Last7Days;
                    break;
                case "lastmonth":
                    reval = ConditionOperator.LastMonth;
                    break;
                case "lastweek":
                    reval = ConditionOperator.LastWeek;
                    break;
                case "lastxdays":
                    reval = ConditionOperator.LastXDays;
                    break;
                case "lastxhours":
                    reval = ConditionOperator.LastXHours;
                    break;
                case "lastxmonths":
                    reval = ConditionOperator.LastXMonths;
                    break;
                case "lastxweeks":
                    reval = ConditionOperator.LastXWeeks;
                    break;
                case "lastxyears":
                    reval = ConditionOperator.LastXYears;
                    break;
                case "lastyear":
                    reval = ConditionOperator.LastYear;
                    break;
                case "lessequal":
                    reval = ConditionOperator.LessEqual;
                    break;
                case "lessthan":
                    reval = ConditionOperator.LessThan;
                    break;
                case "like":
                    reval = ConditionOperator.Like;
                    break;
                case "mask":
                    reval = ConditionOperator.Mask;
                    break;
                case "masksselect":
                    reval = ConditionOperator.MasksSelect;
                    break;
                case "next7days":
                    reval = ConditionOperator.Next7Days;
                    break;
                case "nextmonth":
                    reval = ConditionOperator.NextMonth;
                    break;
                case "nextweek":
                    reval = ConditionOperator.NextWeek;
                    break;
                case "nextxdays":
                    reval = ConditionOperator.NextXDays;
                    break;
                case "nextxhours":
                    reval = ConditionOperator.NextXHours;
                    break;
                case "nextxmonths":
                    reval = ConditionOperator.NextXMonths;
                    break;
                case "nextxweeks":
                    reval = ConditionOperator.NextXWeeks;
                    break;
                case "nextxyears":
                    reval = ConditionOperator.NextXYears;
                    break;
                case "nextyear":
                    reval = ConditionOperator.NextYear;
                    break;
                case "notbetween":
                    reval = ConditionOperator.NotBetween;
                    break;
                case "notequal":
                    reval = ConditionOperator.NotEqual;
                    break;
                case "notequalbusinessid":
                    reval = ConditionOperator.NotEqualBusinessId;
                    break;
                case "notequaluserid":
                    reval = ConditionOperator.NotEqualUserId;
                    break;
                case "notin":
                    reval = ConditionOperator.NotIn;
                    break;
                case "notlike":
                    reval = ConditionOperator.NotLike;
                    break;
                case "notmask":
                    reval = ConditionOperator.NotMask;
                    break;
                case "notnull":
                    reval = ConditionOperator.NotNull;
                    break;
                case "noton":
                    reval = ConditionOperator.NotOn;
                    break;
                case "null":
                    reval = ConditionOperator.Null;
                    break;
                case "olderthanxmonths":
                    reval = ConditionOperator.OlderThanXMonths;
                    break;
                case "on":
                    reval = ConditionOperator.On;
                    break;
                case "onorafter":
                    reval = ConditionOperator.OnOrAfter;
                    break;
                case "onorbefore":
                    reval = ConditionOperator.OnOrBefore;
                    break;
                case "thismonth":
                    reval = ConditionOperator.ThisMonth;
                    break;
                case "thisweek":
                    reval = ConditionOperator.ThisWeek;
                    break;
                case "thisyear":
                    reval = ConditionOperator.ThisYear;
                    break;
                case "today":
                    reval = ConditionOperator.Today;
                    break;
                case "tomorrow":
                    reval = ConditionOperator.Tomorrow;
                    break;
                case "yesterday":
                    reval = ConditionOperator.Yesterday;
                    break;
            }

            return reval;
        }
    }
}
